#include "trdp.hpp"
#include <memory>
#include <thread>
int main(int argc, char **argv)
{
	if (argc < 3)
	{
		printf("usage: %s [local ip] [multi ip]\n", argv[0]);
		return 0;
	}

	try
	{
		trdp::init(std::string(argv[1]), std::string(argv[2]));
		printf("initialized trdpmini %s %s\n", argv[1], argv[2]);
		auto pub = std::make_shared<trdp::pd_pub>(0x1234, 16);
		printf("created publisher\n");
		char data[16] = "hello world";
		while (true)
		{
			pub->update((uint8_t *)data, 16);
			printf("published data\n");
			std::this_thread::sleep_for(std::chrono::milliseconds(100));
		}
	}
	catch (TRDP_MINI_ERR_T err)
	{
		printf("exception: %d\n", err);
	}

	return 0;
}
